package HomeCare_JobScrutationRepertoire;


import java.io.File;

import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

//D:\Homecare\Quartz\Java code\src\test_quartz_v1

/* Define a job in order to test Quartz job scheduler 
 * Job : list the content of a directory
 * This job will be scheduled by JobScheduler class
 * Author Phan
 */ 


public class ScrutationRepertoire implements Job{
private static Logger _log = LoggerFactory.getLogger(ScrutationRepertoire.class);
	
	public void execute(JobExecutionContext context) throws JobExecutionException 
	{
		File rep = new File("~/TestRepertoireScrutationJob");		
		listerRepertoire(rep,".csv");
		
	}		
	
	public static void listerRepertoire(File repertoire,String type){ 

		String [] listefichiers; 

		int i; 
		listefichiers=repertoire.list(); 
		for(i=0;i<listefichiers.length;i++)
		{ 
			if(listefichiers[i].endsWith(type)==true)
			{ 
				_log.info(listefichiers[i].substring(0,listefichiers[i].length()-type.length()));
				// on choisit la sous chaine - les derniers caracteres concernant du type 
			} 
		} 
	}
}




